﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Entities.MSPetShop4
{
    partial class Item : RaisingStudio.Data.Common.IDataObjectProxy
    {
        #region IDataObjectProxy Members

        public Type GetPropertyType(string name)
        {
            switch (name)
            {                
                case "ItemId":
                   {
                       return typeof(string);
                   }
                case "ProductId":
                   {
                       return typeof(string);
                   }
                case "ListPrice":
                   {
                       return typeof(decimal?);
                   }
                case "UnitCost":
                   {
                       return typeof(decimal?);
                   }
                case "Supplier":
                   {
                       return typeof(int?);
                   }
                case "Status":
                   {
                       return typeof(string);
                   }
                case "Name":
                   {
                       return typeof(string);
                   }
                case "Image":
                   {
                       return typeof(string);
                   }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        #endregion

        #region IObjectAccessor Members

        public object GetValue(object instance, string name)
        {
            Item _instance = instance as Item;
            switch (name)
            {                
                case "ItemId":
                   {
                       return _instance.ItemId;
                   }
                case "ProductId":
                   {
                       return _instance.ProductId;
                   }
                case "ListPrice":
                   {
                       return _instance.ListPrice;
                   }
                case "UnitCost":
                   {
                       return _instance.UnitCost;
                   }
                case "Supplier":
                   {
                       return _instance.Supplier;
                   }
                case "Status":
                   {
                       return _instance.Status;
                   }
                case "Name":
                   {
                       return _instance.Name;
                   }
                case "Image":
                   {
                       return _instance.Image;
                   }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        public void SetValue(object instance, string name, object value)
        {
            Item _instance = instance as Item;
            switch (name)
            {                
                case "ItemId":
                    {
                        _instance.ItemId = (string)value;
                        return;
                    }
                case "ProductId":
                    {
                        _instance.ProductId = (string)value;
                        return;
                    }
                case "ListPrice":
                    {
                        _instance.ListPrice = (decimal?)value;
                        return;
                    }
                case "UnitCost":
                    {
                        _instance.UnitCost = (decimal?)value;
                        return;
                    }
                case "Supplier":
                    {
                        _instance.Supplier = (int?)value;
                        return;
                    }
                case "Status":
                    {
                        _instance.Status = (string)value;
                        return;
                    }
                case "Name":
                    {
                        _instance.Name = (string)value;
                        return;
                    }
                case "Image":
                    {
                        _instance.Image = (string)value;
                        return;
                    }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        #endregion

        #region IObjectCreater Members

        public object CreateObject()
        {
            return new Item();
        }

        public System.Collections.IList CreateObjectList()
        {
            return new System.Collections.Generic.List<Item>();
        }

        #endregion
    }
}
